<?php
namespace app\api\controller;

use think\Controller;
use think\facade\Cache;

use app\index\model\Qrcode;

class Verific extends Controller
{
    public function index(){
        $num = input('n');
        $num = trim($num, '"');
        if(Cache::get($num)){
            echo 'setopen';
            exit;
        }
        $qrcode = Qrcode::where('billcode', $num)->find();
        if($qrcode && $qrcode->status === 0){
            $qrcode->status = 1;
            $qrcode->save();
            cache($num, time(), 60);
            echo 'setopen';
        }else{
            echo 'close';
        }
    }

    public function outDoor(){
        $num = input('num');
    }


}